<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>median</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 08/02/2006</div>
    <p>
      <b>median</b> - median (row median, column median,...) of
  vector/matrix/array entries</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>y=median(x)</tt>
      </dd>
      <dd>
        <tt>y=median(x,'r')</tt>
      </dd>
      <dd>
        <tt>y=median(x,'c')</tt>
      </dd>
      <dd>
        <tt>y=median(x,'m')</tt>
      </dd>
      <dd>
        <tt>y=median(x,dim)</tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>x</b>
        </tt>: real vector, matrix or an array</li>
      <li>
        <tt>
          <b>y</b>
        </tt>: scalar,vector, matrix or an array</li>
      <li>
        <tt>
          <b>dim</b>
        </tt>: positive integer</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>For a vector or a matrix <tt>
        <b>x</b>
      </tt>, <tt>
        <b>y=median(x)</b>
      </tt>
    returns in the scalar <tt>
        <b>y</b>
      </tt> the median of all the entries of
    <tt>
        <b>x</b>
      </tt>.</p>
    <p>
      <tt>
        <b>y=median(x,'r')</b>
      </tt> (or, equivalently,
    <tt>
        <b>y=median(x,1)</b>
      </tt>) is the median along the row index. It returns
    in each entry of the column vector <tt>
        <b>y</b>
      </tt> the median of each
    column of <tt>
        <b>x</b>
      </tt>.</p>
    <p>
      <tt>
        <b>y=median(x,'c')</b>
      </tt> (or, equivalently,
    <tt>
        <b>y=median(x,2)</b>
      </tt>) is the median along the column index. It
    returns in each entry of the row vector <tt>
        <b>y</b>
      </tt> the median of each
    row of <tt>
        <b>x</b>
      </tt>.</p>
    <p>
      <tt>
        <b>y=median(x,'m')</b>
      </tt> is the median along the first non
    singleton dimension of <tt>
        <b>x</b>
      </tt> (for compatibility with matlab).</p>
    <p>
      <tt>
        <b>y=median(x,dim)</b>
      </tt> is the median along the dimension
    <tt>
        <b>dim</b>
      </tt> of <tt>
        <b>x</b>
      </tt> (for compatibility with matlab).</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

A=[1,2,10;7,7.1,7.01];
median(A)
median(A,'r')
median(A,'c')
A=matrix([-9 3 -8 6 74 39 12 -6 -89 23 65 34],[2,3,2]);
median(A,3)
median(A,'m')
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="../elementary/sum.htm">
        <tt>
          <b>sum</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="mean.htm">
        <tt>
          <b>mean</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
